import {axios,url} from '.';

export const getStudentList = async() => {
    const response =  await axios({
        method: 'get',
        url: url + '/students',
        
       
    });
    return response.data;
}
export const getStudentById = async(id) => {
    const response =  await axios({
        method: 'get',
        url: url + '/studentById',
        params:{
            id
        }
       
    });
    return response.data;
}
export const addStudent = async(student) => {
    const response =  await axios({
        method: 'post',
        url: url + '/addStudent',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        data:student
       
    });
    return response.data;
}
export const updateStudent = async(student) => {
    const response =  await axios({
        method: 'post',
        url: url + '/updateStudent',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        data:student
       
    });
    return response.data;
}
export const deleteStudent = async(id) => {
    const response =  await axios({
        method: 'post',
        url: url + '/deleteStudent',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        data:{
            id
        }
       
    });
    return response.data;
}